from django import forms


class UploadFileForm(forms.Form):
    # title = ""
    # file = ""
    title = forms.CharField(max_length=50)
    file = forms.FileField()
    # return forms
    print("输出测试的功能:", title, file)


def handle_uploaded_file(file, name):
    files = file.getlist('file')
    for f in files:
        destination = open('static/file/{}'.format(name), 'wb+')
        for chunk in f.chunks():
            destination.write(chunk)
    destination.close()
